/*
 *  StateManager.h
 *  SpaceTrader
 *
 *  Created by Jake on 9/21/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */
#pragma once

#include "GuiTools.h"
#include "SpaceTrader.h"
#include "Planet.h"
#include "Universe.h"
#include "TitleScene.h"
#include "StatsScene.h"
#include "CombatScene.h"
#include "PlanetScene.h"
#include "MapScene.h"
#include "MarketScene.h"
#include "Market.h"
#include "TravelScene.h"
#include "CommonsScene.h"
#include "ShipyardScene.h"
#include "boost/archive/text_oarchive.hpp"
#include "boost/archive/text_iarchive.hpp"
#include <fstream>

class StateManager
{
private:
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        //for serialization, save/load these fields.
        ar & player;
        ar & curr_planet;
        ar & universe;
    }
	
    //fields
	state_t curr_state;
	Player *player;
	Market *market;
    Universe *universe;
    Planet *curr_planet;
    
    //scenes
    TitleScene *titleScene;
    StatsScene *statsScene;
    CombatScene *combatScene;
    PlanetScene *planetScene;
    MapScene *mapScene;
    MarketScene *marketScene;
    TravelScene *travelScene;
	CommonsScene *commonsScene;
    ShipyardScene *shipyardScene;
	
	int distance;
	bool trader; //whether or not the market is a merchant/planet
	
public:
	
	StateManager();
	
	state_t getState(void);
    
    state_t render(SDL_Surface *screen);
	
    void setState(state_t nextState);
    
    Planet *getPlanet();
    
    void setPlanet(Planet *p);
	
	Player *getPlayer();

};
